package com.xzh.wms.controller;

import com.xzh.wms.service.PoItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.xzh.wms.entity.*;
import com.xzh.wms.service.PoMasterService;
import java.util.List;

 /**
 * 采购单头;(206_po_master)控制层
 * @author : heimi
 * @date : 2024-11-25
 */
@RestController
@RequestMapping("/api/po")
public class PoController {
    @Autowired
    private PoMasterService poMasterService;

     @Autowired
     private PoItemService poItemService;
    
    /** 
     * 查询接口
     */
     @GetMapping
     public List<PoMaster> select(PoMasterQuery query){
        return poMasterService.select(query);
    }
     @GetMapping("/item")
     public List<PoItem> selectItem(PoItemQuery query){
         return poItemService.select(query);
     }
    
    @PostMapping 
    public Integer insert(@RequestBody PoMaster product){
       return poMasterService.insert(product);
    }
    
    @PutMapping 
    public Integer update(@RequestBody PoMaster product){
        return poMasterService.update(product);
    }
    
    @DeleteMapping
    public Integer delete(Integer id){
        return poMasterService.delete(id);
    }
}